package com.neasho.neashoadminv1.infrastructure.domain.sys

import com.neasho.neashoadminv1.infrastructure.domain.base.BaseEntity
import org.babyfish.jimmer.sql.Entity
import org.babyfish.jimmer.sql.Id
import org.babyfish.jimmer.sql.GeneratedValue
import org.babyfish.jimmer.sql.GenerationType
import org.babyfish.jimmer.sql.IdView
import org.babyfish.jimmer.sql.JoinColumn
import org.babyfish.jimmer.sql.Key
import org.babyfish.jimmer.sql.OneToOne
import org.babyfish.jimmer.sql.Table
import java.time.LocalDateTime

/**
 * 系统 - 用户token表
 */
@Entity
@Table(name = "sys_user_token")
interface SysUserToken : BaseEntity {
    /**
     * token
     */
    @Key
    val token: String

    /**
     * 用户id
     */
    @IdView
    val userId: Long

    /**
     * 过期时间
     */
    val expireAt: LocalDateTime

    @OneToOne
    @JoinColumn(name = "user_id")
    val user: SysUser
}

